<?php
	include_once('classes/view.php');
	View::displayHeader();
	
		echo '		
		<script type="text/javascript">
			function validateOnSubmit() {
		    	var elem;
		    	var myCountErrors=0;
		    		    	
		    	if (!validatePresent (document.forms.contact.topic,  \'inf_topic\'))       myCountErrors += 1;
		    	if (!validatePresent (document.forms.contact.message,  \'inf_message\'))   myCountErrors += 1;
		    	if (!validateEmail   (document.forms.contact.email, \'inf_email\', true))  myCountErrors += 1; 
		    	 
		    	if (myCountErrors > 1)  alert(\'Należy poprawić kilka pól.\');
		    	else if (myCountErrors == 1) alert(\'Należy poprawić jedno pole.\');
		
		    	return (myCountErrors == 0);
		  	};
		</script>
		
		<form name="contact" method="post" onsubmit="return validateOnSubmit()" action="send_email.php">
			<div class="box">
				<h1>Formularz kontaktowy :</h1>
				  <label>
				    <span>&nbsp;Temat wiadomości: </span>
				    <input class="wpis" type="text" name="topic" id="topic" size="70" maxlength="70" onchange="validatePresent(this, \'inf_topic\');"  />
				    <i id="inf_topic">Pole wymagane</i>
				  </label>
				
				  <label>
				    <span>Twój e-mail:</span>
				    <input class="wpis" type="text" name="email" id="email" size="70" maxlength="70" onchange="validateEmail(this, \'inf_email\', true);" />
				    <i id="inf_email">Pole wymagane</i>
				  </label>
				  
				  <label>
				    <span>Treść wiadomości: </span>
				    <textarea class="wiadomosc" name="message" rows="5" cols="70" onchange="validatePresent(this, \'inf_message\');" > </textarea>
				    <i id="inf_message">Pole wymagane</i>
				    
				  </label>
				  
				  <label>
				  	<input class="button" type="Submit" name="Submit" value="Wyślij" />
				  </label>
			</div>
		</form>
		<br /><br />
		<br /><br />
		<br />
		';
	
	View::displayFooter();
?>